//------机构测算方案----------

import request from "@/router/axios";


//查询
export function fetchList(query) {
  return request({
    url: '/bonus/bonusdeptcompute/page',
    method: 'get',
    params: query
  })
}

//新增
export function addObj(obj) {
  return request({
    url: '/bonus/bonusdeptcompute',
    method: 'post',
    data: obj
  })
}

//编辑
export function putObj(obj) {
  return request({
    url: '/bonus/bonusdeptcompute',
    method: 'put',
    data: obj
  })
}


//删除
export function deleteBatch(query) {
  return request({
    url: '/bonus/bonusdeptcompute/deleteBatch',
    method: 'get',
    params: query
  })
}


//测算 - 获取测算方案id 奖金池金额
export function getProgrammeId(obj) {
  return request({
    url: '/bonus/bonusdeptcomputesub',
    method: 'post',
    data: obj
  })
}


//新增测算机构/虚拟组
export function addOrgOrGroup(obj) {
  return request({
    url: '/bonus/bonusdeptcomputedetail/saveList',
    method: 'post',
    data: obj
  })
}

//保存公式
export function saveFormula(id,formulaId) {
  return request({
    url: '/bonus/bonusdeptcomputesub/saveFormula/'+ id + '/' + formulaId,
    method: 'get',
  })
}

//单元格的值改变时
export function saveCell(query) {
  return request({
    url: '/bonus/bonusdeptcomputedetail/updateSingle',
    method: 'get',
    params:query
  })
}

//获取要测算的机构列表
export function measureOrgList(query) {
  return request({
    url: '/bonus/bonusdeptcomputedetail/list',
    method: 'get',
    params:query
  })
}





//计算
export function compute(query) {
  return request({
    url: '/bonus/bonusdeptcomputedetail/toCompute',
    method: 'get',
    params:query
  })
}


//保存选择参与计算的项
export function saveConfigItem(obj) {
  return request({
    url: '/bonus/bonusdeptcompute/saveViewColumn' ,
    method: 'put',
    data: obj
  })
}

//测算 - 获取配置的动态列(与列表页的【配置】中选择的有关)
export function getViewColumn(id) {
  return request({
    url: `/bonus/bonusdeptcompute/getViewColumn/${id}`,
    method: 'get',
  })
}


//保存- 给子奖金项分配金额功能
export function saveBonusCount(obj) {
  return request({
    url: '/bonus/bonusdeptcompute/saveSublist',
    method: 'post',
    data: obj
  })
}

//将方案提交至工作流
export function submitToProcess(computeId) {
  return request({
    url: '/bonus/bonusdeptcompute/complete/' + computeId,
    method: 'get',
  })
}

//测算审批完后，进行下一步分配（人员|机构）
export function nextDivide(type,id) {
  return request({
    url: '/bonus/bonusdeptcompute/next/'+ type + '/' + id,
    method: 'get',
  })
}

//方案对比 - 获取动态列
export function getDynamicColumns(query) {
  return request({
    url: '/bonus/bonusdeptcompute/compare',
    method: 'get',
    params: query
  })
}

//提交到审批流
export function submitToProcessMulScheme(ids) {
  return request({
    url: '/bonus/bonuspartialschemereview/saveApproval/'+ids,
    method: 'put',
    // params: query
  })
}
